<template>
  <el-dialog
      :title="title"
      custom-class="x-large-dialog"
      :visible="visible"
      append-to-body
      @open="open"
      @close="close"
  >
    <div class="search-pannel">
      <el-form
          class="search-form"
          :model="postData"
          label-position="top"
          :rules="postRules"
          ref="postForm"
      >
        <el-row>
          <el-col :span="24">
            <el-form-item label="角色" prop="rid">
              <el-select v-model="postData.rid">
                <el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.name" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div slot="footer">
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { _put, _getDetail } from '../src/store'
import { getAllRole, postDialog } from '@/mixins'

export default {
  name: 'postDialog',
  mixins: [postDialog, getAllRole],
  data() {
    return {
      postData: {
        rid: ''
      },
      postRules: {
        name: [{ required: true, message: '请选择角色', trigger: 'blur' }]
      },
      isDisabled: true,
      editFunc: _put,
      detailFunc: _getDetail
    }
  },
  methods: {
    save() {
      const tempArr = this.$refs.tree.getCheckedNodes(false, true)
      this.postData.auth = tempArr.map(item => item.id).sort((a, b) => { return a - b }).join()
      this.submit()
    }
  }
}
</script>

<style scoped>

</style>
